package com.dao;


import com.model.MyIp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;


import java.text.SimpleDateFormat;
import java.util.Date;

@Component

public class Scheduled {

    @Autowired
    IMyip iMyip;

    @org.springframework.scheduling.annotation.Scheduled(fixedRate = 10000)
    public void run(){
        MyIp myIp = new MyIp("198.333.333.333",1,new Date(),"自动插入");
        iMyip.addMyIp(myIp);
    }

    @org.springframework.scheduling.annotation.Scheduled(fixedRate = 5000)
    public void run1(){
        System.out.println(iMyip.allCount());
    }

    @org.springframework.scheduling.annotation.Scheduled(fixedRate = 5000)
    public void run2(){
        System.out.println(iMyip.getNew10());
    }
}
